home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d1 / cmdpost7.arc / CP_INST.SFX / lha / CP_HELP.CRD (.txt) < prev    next >
Cardfile Document  |  1990-07-15  |  28KB  |  1,135 lines

  1. ----------------------------------------
  2.  @@ Command Post Language Summary @@
  3. ........................................
  4. Copyright 1988-1990, Morrie Wilson
  5. All rights reserved.
  6.  
  7. This cardfile contains a quick summary of all the Command Post Menu Language functions.  
  8.  
  9. Wilson WindowWare
  10. 2701 California Ave SW #212
  11. Seattle Wa, 98116
  12. (206) 937-9335    FAX (206) 935-7129
  13. ----------------------------------------
  14. ----------------------------------------
  15.  @@ New Functions --  Info retrival
  16. ........................................
  17. The following functions are not in the 7.0 manual:
  18.  
  19. IsLicensed  ...Tells if CP licensed
  20. IsKeyDown   ...Tells about keys/mouse
  21. DOSVersion  ...Returns DOS/OS2 version
  22. WinConfig   ...Returns WIN3 mode flags
  23. WinPosition ...Returns Window position
  24. WinExist    ...Tells is Window exists
  25. ----------------------------------------
  26. ----------------------------------------
  27.  @@ New Functions -- Filename Parsing
  28. ........................................
  29. The following functions are not in the 7.0 manual:
  30.  
  31. FileRoot       ...returns root of file
  32. FileExtension  ...returns ext of file
  33. FilePath       ...returns path of file 
  34. ----------------------------------------
  35. ----------------------------------------
  36.  @@ New Functions -- Network Support
  37. ........................................
  38. The following functions are not in the 7.0 manual:
  39.  
  40. DiskReset ...re-examines available disks
  41. DiskHide  ...Hides disks from display
  42. ----------------------------------------
  43. ----------------------------------------
  44.  @@ New Functions -- String Handling
  45. ........................................
  46. The following functions are not in the 7.0 manual:
  47.  
  48. StrReplace  ...Replaces all occurances
  49.                of a substring with                      another
  50. ----------------------------------------
  51. ----------------------------------------
  52.  Menu Structure
  53. ........................................
  54. Main Menu Name A
  55.  DropDown Menu Name A-1
  56.     <statements>
  57.  DropDown menu Name A-2
  58.     <statements>
  59. Main Menu Name B
  60.  DropDown menu name B-1
  61.     <statements>
  62. ; Comment.
  63. ; Next line declares a 2nd .cpm file:
  64. #NextFile SECOND.CPM
  65. ----------------------------------------
  66. ----------------------------------------
  67.  Variables
  68. ........................................
  69. Variable names start with a letter.
  70.  
  71. The rest of the name consists of letters and numbers, up to 30 characters total.
  72.  
  73. Variable names are NOT case sensitive, i.e. "Cat" and "cAT" are the same variable.
  74. ----------------------------------------
  75. ----------------------------------------
  76. !
  77. ........................................
  78. The logical NOT operator.
  79.  
  80. Produces @TRUE if the operand = zero, @FALSE if it's nonzero.
  81. ----------------------------------------
  82. ----------------------------------------
  83. &      |      ^
  84. ........................................
  85. The bitwise AND, OR, and XOR operators.
  86.  
  87. The operator will arithmetically AND, OR, or exclusive-OR two integers together.  
  88.  
  89. a=5;        = 101
  90. b=4        = 100
  91. c=a & b  ; c=4    = 100
  92. d=a | b  ; d=5  = 101
  93. e=a ^ b  ; e=1  = 001
  94. ----------------------------------------
  95. ----------------------------------------
  96. &&    ||
  97. ........................................
  98. The logical AND and OR operators.
  99.  
  100. These operators will logically AND or OR two numbers together.  
  101.  
  102. a=0    ;0 means FALSE
  103. b=4    ;nonzero means TRUE
  104. c=a && b  ; c is @FALSE ( 0 )
  105. d=a || b  ; d is @TRUE  ( 1 )
  106.  
  107. See also & | and ^
  108. ----------------------------------------
  109. ----------------------------------------
  110. (   )
  111. ........................................
  112. Parentheses.
  113.  
  114. Parentheses are used to control the order an expression is evaluated.
  115.  
  116. a = (4+5) * 2    ; a is 18
  117. a = 4 + (5 * 2)  ; a is 14
  118. ----------------------------------------
  119. ----------------------------------------
  120. *   /   +   -    mod (binary)
  121. ........................................
  122. Simple arithmetic operators.
  123.  
  124. *   Multiplication
  125. /   Division
  126. +   Addition
  127. -   Subtraction
  128. mod Modulo  (divide, return remainder)
  129.  
  130. See also abs, min, max
  131. ----------------------------------------
  132. ----------------------------------------
  133. ~
  134. ........................................
  135. Bitwise NOT operator.
  136.  
  137. Sets all 0 bits of the integer operand to 1, and vice-versa.
  138.  
  139. a=26    ;=00110100
  140. b=~a    ;=11001011, or -27
  141. ----------------------------------------
  142. ----------------------------------------
  143. +   -   (unary)
  144. ........................................
  145. Unary arithmetic operators.
  146.  
  147. +  Identity
  148. -  Negation
  149. ----------------------------------------
  150. ----------------------------------------
  151. <<    >>
  152. ........................................
  153. Bitwise shift operators.
  154.  
  155. <<  Left Shift
  156. >>  Right Shift
  157.  
  158. c= 16 >> 2    ; c is 4
  159. d= 16 << 2    ; c is 64
  160. ----------------------------------------
  161. ----------------------------------------
  162. =
  163. ........................................
  164. The assigment operator.
  165.  
  166. Assigns the value or string evaluated on the right side of the = sign to the variable on the left side.
  167. ----------------------------------------
  168. ----------------------------------------
  169. ==   !=   <>   <=   >=   >   <
  170. ........................................
  171. Relational operators. 
  172.  
  173. ==      Equality
  174. !=  <>  Inequality
  175. <=      Less than or equal to
  176. >=      Greater than or equal to
  177. <       Less than
  178. >       Greater than
  179. These produce 0 (@FALSE) or 1 (@TRUE).
  180.  
  181. See also StrCmp, StrICmp
  182. ----------------------------------------
  183. ----------------------------------------
  184. Abs (number)
  185. ........................................
  186. Returns the absolute (positive) value of an integer number.
  187.  
  188.  
  189. Fred=Abs(-4)  ;Fred becomes 4
  190. ----------------------------------------
  191. ----------------------------------------
  192. AskLine (title, prompt, default)
  193. ........................................
  194. Gets a line of info from the user.
  195.  
  196. title  = title of the dialog box.
  197. prompt = question shown above edit box.
  198. default= default entry in edit box.
  199.  
  200. Returns string the user enters into the edit box.
  201. ----------------------------------------
  202. ----------------------------------------
  203. AskYesNo (title, prompt)
  204. ........................................
  205. Asks the user a yes or no question.
  206.  
  207. title    = title of the dialog box.
  208. prompt    = string shown above edit box.
  209.  
  210. Returns @YES or @NO depending on which button they press.
  211. ----------------------------------------
  212. ----------------------------------------
  213. Average (num [,num]...)
  214. ........................................
  215. Finds the average of a list of integers.
  216.  
  217. Returns average of the numbers, to the closest integer.
  218.  
  219.  
  220. ----------------------------------------
  221. ----------------------------------------
  222. Beep
  223. ........................................
  224. Sounds a short beep at the user.
  225.  
  226.  
  227.  
  228.  
  229. Beep
  230. Message("Be Alert","We need more lerts")
  231. ----------------------------------------
  232. ----------------------------------------
  233. Char2Num (string)
  234. ........................................
  235. Converts the first character of a string to its ANSI code.
  236.  
  237.  
  238.  
  239. a=Char2Num("Z")
  240. Message("Z's ANSI Code is",a)
  241. ----------------------------------------
  242. ----------------------------------------
  243. ClipAppend (string)
  244. ........................................
  245. Appends a string to the clipboard.  
  246. Clipboard must contain text, or be empty.
  247.  
  248. a="First"
  249. b="Second"
  250. ClipPut(a)
  251. ;clipboard = "First"
  252. ClipAppend(b)
  253. ;clipboard = "FirstSecond"
  254. ----------------------------------------
  255. ----------------------------------------
  256. ClipGet ()
  257. ........................................
  258. Retrieves the contents of the Clipboard into a string variable.  
  259. Clipboard must contain only text.
  260.  
  261. a=ClipGet()
  262. Message("Clipboard",a)
  263. ----------------------------------------
  264. ----------------------------------------
  265. ClipPut (string)
  266. ........................................
  267. Clears the clipboard and inserts a "string" into it.  Clipboard will be marked as containing text.
  268.  
  269.  
  270. a="First"
  271. b="Second"
  272. ClipPut(a)
  273. ;clipboard = "First"
  274. ClipAppend(b)
  275. ;clipboard = "FirstSecond"
  276. ----------------------------------------
  277. ----------------------------------------
  278. CurrentFile()
  279. ........................................
  280. Returns the currently selected filename. 
  281.  
  282. The currently selected file name is the one with the dashed box around it.
  283.  
  284. If could be a directory if that is what the dashed box is around.
  285. ----------------------------------------
  286. ----------------------------------------
  287. DateTime ()
  288. ........................................
  289. Returns the current system date and time using the format declared in the International section of the WIN.INI file.
  290.  
  291.  
  292. Message("Date and Time is",DateTime())
  293. ----------------------------------------
  294. ----------------------------------------
  295. Debug (@ON | @OFF)
  296. ........................................
  297. Turns the statement debugging dialog box on or off.
  298. ----------------------------------------
  299. ----------------------------------------
  300. Delay (seconds)
  301. ........................................
  302. Delays "seconds" seconds.  While the delay is in progress other windows will receive processing time.
  303.  
  304. message("TEST","See you later")
  305. delay(10)
  306. message("TEST","I'm BAAAAAACK!")
  307. ----------------------------------------
  308. ----------------------------------------
  309. DirChange ([d:] path)
  310. ........................................
  311. Changes the current directory.
  312.  
  313. If the pathname includes a different drive than the current one, it will log onto the new drive.
  314.  
  315.  
  316. DirChange ("d:\winword")
  317. DirChange ("mysubdir")
  318.  
  319. ----------------------------------------
  320. ----------------------------------------
  321. DirGet ()
  322. ........................................
  323. Returns the current directory.
  324. ----------------------------------------
  325. ----------------------------------------
  326. DirHome ()
  327. ........................................
  328. Returns the path to the Command Post executable files.
  329. ----------------------------------------
  330. ----------------------------------------
  331. DirItemize (dir-spec)
  332. ........................................
  333. Returns either all the highlighted directories (if dir-spec = "") or the list of directories matching a set of wildcards.  Usually "*.*" is used.
  334.  
  335. The directory names are separated by spaces.
  336.  
  337. DirItemize("")    ;returns hilited dirs
  338. DirItemize("*.*") ;returns all dirs
  339. ----------------------------------------
  340. ----------------------------------------
  341. DirMake ([d:] path)
  342. ........................................
  343. Creates a new directory.
  344.  
  345.  
  346. DirMake ("Child")
  347. DirMake ("..\..\Uncle")
  348. DirMake ("..\..\Uncle\Cousin")
  349. ----------------------------------------
  350. ----------------------------------------
  351. DirRemove ([d:] path)
  352. ........................................
  353. Deletes a directory.
  354.  
  355.  
  356. DirRemove ("..\..\Uncle\Cousin")
  357.  
  358. ----------------------------------------
  359. ----------------------------------------
  360. DiskFree (drive-list)
  361. ........................................
  362. Returns the total available free space of all drives in the list.
  363.  
  364. a=DiskFree("C D")  ;get free space
  365. a=a/1024           ;convert to "K"
  366. Message ("Free space on C&D","%a%K")
  367. ----------------------------------------
  368. ----------------------------------------
  369. DiskHide (Drive-Letter-List)
  370. ........................................
  371. Instructs Command Post to suppress the disk drive icon display for all drives in the Drive-Letter-List.
  372.  
  373. E.G. If you are on a network, and NEVER care what drives S,T,U,V and W have on them, you may issue the command:
  374.  
  375. DiskHide("STUVW")  
  376. ----------------------------------------
  377. ----------------------------------------
  378. DiskReset ()
  379. ........................................
  380. DiskReset causes Command Post to re-examine all attached drives.  This command is used after attaching or detaching network drives to re-sync the display to the state of the network.
  381. ----------------------------------------
  382. ----------------------------------------
  383. Display (seconds, title, text)
  384. ........................................
  385. Displays a message for the indicated number of seconds.
  386.  
  387. You can stop the display by clicking on the message box with the mouse or pressing a key.
  388.  
  389. Display(5,"!!!","Bye bye in 5 seconds")
  390. ----------------------------------------
  391. ----------------------------------------
  392. DOSVersion (@MAJOR | @MINOR)
  393. ........................................
  394. Returns the version numbers of the current version of DOS.
  395. "level" = @MAJOR returns the integer part and @MINOR returns the decimal part (to the right of the decimal).
  396.  
  397. r=DOSVersion(@MAJOR)
  398. v=DOSVersion(@MINOR)
  399. Message("DOS Version","%r%.%v%")
  400. ----------------------------------------
  401. ----------------------------------------
  402. Drop (var [,var]...)
  403. ........................................
  404. Deletes variables from the varaible list, thus conserving memory.
  405.  
  406. This is a recommended practice for local variables.
  407. ----------------------------------------
  408. ----------------------------------------
  409. EndSession ()
  410. ........................................
  411. Ends the current Windows session.
  412.  
  413. Has the same effect as choosing File/Exit in Win 2.x, or closing the Program Manager in Win 3.0
  414. ----------------------------------------
  415. ----------------------------------------
  416. Environment (env-variable)
  417. ........................................
  418. Returns the contents of a DOS environ- ment variable.
  419.  
  420. a=Environment("PATH")
  421. Message("Your PATH is",a)
  422. ----------------------------------------
  423. ----------------------------------------
  424. ErrorMode(@OFF | @NOTIFY | @CANCEL)
  425. ........................................
  426. Controls the error handling mode.  @CANCEL (the default):  Cancels the menu item at any error.
  427. @NOTIFY:  Informs the user and allows her to continue if the error is recoverable.
  428. @OFF: Same as @NOTIFY, but suppresses any recoverable errors.
  429.  
  430.  
  431. ERRORMODE(@OFF)
  432. ----------------------------------------
  433. ----------------------------------------
  434. Execute statement
  435. ........................................
  436. Executes a statement in an "error protected" environment.  Any error will be recoverable.  Often used to interactively execute user-typed statements.
  437.  
  438. A=AskLine("DO","Enter Stmt","")
  439. Execute %A%
  440. ----------------------------------------
  441. ----------------------------------------
  442. Exit
  443. ........................................
  444. Used to end processing a menu item.
  445.  
  446. Exit is assumed at the end of all menu items.
  447.  
  448.  
  449. b=0
  450. Exit
  451. ----------------------------------------
  452. ----------------------------------------
  453. FileCopy (from-list, to-name, warn)
  454. ........................................
  455. Copies one or more filenames to the destination "to-name".  Wildcards may be used.  If more than one file is copied, to-name should be a wildcard.
  456.  
  457. If "warn" is @TRUE, the user will get a warning before overwriting a file.
  458.  
  459. FileCopy("C:\win\*.*", "A:", @TRUE)
  460.  
  461. ----------------------------------------
  462. ----------------------------------------
  463. FileDelete (file-list)
  464. ........................................
  465. Deletes one or more files.  More than one filename may be specified.  Wildcards may be used.
  466.  
  467.  
  468. FileDelete("*.BAK *.OLD")
  469. ----------------------------------------
  470. ----------------------------------------
  471. FileExist (filename)
  472. ........................................
  473. Determines whether or not a file exists. 
  474.  
  475. Returns @TRUE or @FALSE.
  476.  
  477. Unless it is a full pathname, The current directory will be checked, and then all directories on the DOS PATH will be checked.
  478.  
  479. a=FileExist ("WIN.INI")
  480. a=FileExist ("c:\windows\win.ini")
  481. ----------------------------------------
  482. ----------------------------------------
  483. FileExtension (filename)
  484. ........................................
  485. FileExtension parses the passed filename and returns the extension part of the filename.
  486. ----------------------------------------
  487. ----------------------------------------
  488. FileItemize (file-list)
  489. ........................................
  490. Returns either a list of highlighted files (if file-list = "") or the list of files matching the set of wildcards specified.
  491.  
  492. The filenames are separated by spaces.
  493.  
  494. FileItemize("") ;returns hilited files
  495. FileItemize("*.BAK") ;returns all BAK's
  496. FileItemize("*.ARC *.ZIP *.LZH")
  497.       ;returns list of compressed files
  498. ----------------------------------------
  499. ----------------------------------------
  500. FileLocate (filename)
  501. ........................................
  502. Attempts to find "filename" in the current directory, and along the DOS PATH.  If found, the function will return the complete pathname to the file.
  503.  
  504. a=FileLocate("WIN.INI")
  505. Message("WIN.INI is located in",a)
  506.  
  507. ----------------------------------------
  508. ----------------------------------------
  509. FileMove (from-list, to-name, warn)
  510. ........................................
  511. Moves one or more filenames to the destination "to-name".  Wildcards may be used.  If more than one file is moved, "to-name" should be a wildcard.
  512.  
  513. If the destination is on the same drive, a rename will occur instead of a move. 
  514. If "warn" = @TRUE the user gets a warning before overwriting a file.
  515.  
  516. FileMove("C:\win\*.*","A:",@TRUE)
  517. ----------------------------------------
  518. ----------------------------------------
  519. FilePath (filename)
  520. ........................................
  521. FilePath parses the passed filename and returns the drive and path of the file specification, if any.
  522. ----------------------------------------
  523. ----------------------------------------
  524. FileRename (file-list, to-name)
  525. ........................................
  526. Renames one or more filenames to the destination "to-name".  Wildcards may be used.  If more than one file is renamed, "to-name" should be a wildcard.
  527.  
  528. The destination MUST be on the same drive as the source.  You may wish to use FileMove instead of FileRename. 
  529.  
  530. FileMove("C:\win\*.*","A:")
  531. ----------------------------------------
  532. ----------------------------------------
  533. FileRoot (filename)
  534. ........................................
  535. FileRoot parses the passed filename and returns the root part of the filename.
  536. ----------------------------------------
  537. ----------------------------------------
  538. FileSize (file-list)
  539. ........................................
  540. Adds the sizes of all the files in the list and returns the total.
  541.  
  542. a=FileSize(FileItemize("*.*"))
  543. Message("Size of all files in dir",a)
  544. ----------------------------------------
  545. ----------------------------------------
  546. IniRead (section, keyword, default)
  547. ........................................
  548. Looks up a value in the WIN.INI file.  If the value is not found, the "default" will be returned.
  549.  
  550. IniRead ("windows","device","none")
  551. will look in
  552.  
  553. [windows]
  554. device=...
  555.  
  556. and return the default ptr or "none".
  557. ----------------------------------------
  558. ----------------------------------------
  559. IniWrite (section, keyword, data)
  560. ........................................
  561. Modifies the WIN.INI file with the desired data.
  562.  
  563.  
  564.  
  565. IniWrite("CmdPost","MyVar",5)
  566. will create a new keyword entry in the CmdPost section:
  567.  
  568. [CmdPost]
  569. MyVar=5
  570. ----------------------------------------
  571. ----------------------------------------
  572. IsDefined (variable)
  573. ........................................
  574. Determines whether or not a variable has been defined.
  575.  
  576. Returns @YES or @NO.
  577.  
  578. ----------------------------------------
  579. ----------------------------------------
  580. IsKeyDown(key-codes)
  581. ........................................
  582. Determines if the SHIFT key or the CTRL key is currently down.
  583.     IsKeyDown(@SHIFT)
  584.     IsKeyDown(@CTRL)
  585.     IsKeyDown(@CTRL|@SHIFT)
  586.     IsKeyDown(@CTRL&@SHIFT)
  587.  
  588. Returns TRUE or FALSE.
  589. Note: Right Mouse button same as SHIFT
  590.       Middle button same as CTRL
  591. ----------------------------------------
  592. ----------------------------------------
  593. IsLicensed()
  594. ........................................
  595. Returns whether or not the current version of Command Post is a licensed copy or not.
  596.  
  597. Mainly used to predict what CP's window titles are going to be.  In the unlicensed versions, the titles are fixed.  In licensed versions, they are programmable.
  598. ----------------------------------------
  599. ----------------------------------------
  600. IsMenuChecked (menuname)
  601. ........................................
  602. Determines whether or not a menu item is currently checked.  Returns @YES or @NO.
  603.  
  604.  
  605. ----------------------------------------
  606. ----------------------------------------
  607. IsMenuEnabled (menuname)
  608. ........................................
  609. Determines whether or not a menu item is currently enabled (i.e. not grayed).  Returns @YES or @NO.
  610.  
  611. Terminate(!IsMenuEnabled,"ViewName","")
  612.  
  613. ----------------------------------------
  614. ----------------------------------------
  615. IsNumber (string)
  616. ........................................
  617. Determines if a string can be converted into a number.
  618.  
  619. Returns @YES or @NO.
  620.  
  621. n=AskLine("TEST","Enter a number",entry)
  622. Terminate(!IsNumber(entry),"Must Enter a
  623.                   Number")
  624.  
  625. ----------------------------------------
  626. ----------------------------------------
  627. IsRunning ()
  628. ........................................
  629. Returns @TRUE if another copy of Command Post is already running.
  630.  
  631. Returns @FALSE if this is the first instance of Command Post.
  632. ----------------------------------------
  633. ----------------------------------------
  634. Itemselect (title, list, delimiter)
  635. ........................................
  636. Returns a single item chosen from a list box presented to the user.  The items in the list must be separated by the "delimiter" character - usually " " for dirs and files, and a tab for window titles.
  637.  
  638. a=FileItemize("*.DOC")
  639. a=ItemSelect("Files",a," ")
  640. b=WinItemize()
  641. b=ItemSelect("Windows",b,char2num(9))
  642. ----------------------------------------
  643. ----------------------------------------
  644. LastError ()
  645. ........................................
  646. Returns a numeric value representing the last error that occurred.  Each error has a different value.  0 means no error occurred.   
  647.  
  648. To use use LastError, ErrorMode() must be set to @NOTIFY or @OFF to avoid the default @CANCEL on error recovery.
  649. ----------------------------------------
  650. ----------------------------------------
  651. LogDisk (diskdrive)
  652. ........................................
  653. Selects the first character of the "diskdrive" string and logs that disk as the current disk.
  654.  
  655. DirChange will log a new drive if the pathname you want to change to is on a different one than the current one.
  656.  
  657. LogDisk("D")
  658.  
  659.  
  660. ----------------------------------------
  661. ----------------------------------------
  662. Max (num [,num]...)
  663. ........................................
  664. Examines a series of integers and returns the largest number in the list.
  665.  
  666.  
  667. a=max(100, -50, 30, 200, 10)
  668. message("answer will be 200",a)
  669. ----------------------------------------
  670. ----------------------------------------
  671. MenuChange (menuname, flags)
  672. ........................................
  673. Changes a menu item to be checked or unchecked, enabled or disabled(grayed).
  674.  
  675. The permissable flags are
  676. @CHECK or @UNCHECK
  677. @ENABLE or @DISABLE
  678.  
  679. @CHECK or @UNCHECK may be or'ed with @ENABLE or @DISABLE using the | operator.
  680. ----------------------------------------
  681. ----------------------------------------
  682. Message (title, text)
  683. ........................................
  684. Displays a message box to the user, with a specified "title" and "text".
  685.  
  686. There will be an OK button for the user to press.
  687.  
  688. Message("Hello","This is an example.")
  689. ----------------------------------------
  690. ----------------------------------------
  691. Min (num [,num]...)
  692. ........................................
  693. Examines a series of integers and returns the smallest number in the list.
  694.  
  695.  
  696. a=min(100, -50, 30, 200, 10)
  697. message("answer will be -50", a)
  698. ----------------------------------------
  699. ----------------------------------------
  700. Num2Char (number)
  701. ........................................
  702. Converts a number to a one-character string.  Use this to display special ANSI characters.
  703.  
  704. tab=num2char(9)
  705. c=num2char(169) ;(c) symbol
  706. Message("Command Post", "%c%1990")
  707.  
  708.  
  709.  
  710. ----------------------------------------
  711. ----------------------------------------
  712. OtherDir ()
  713. ........................................
  714. Returns the drive and directory that the "other" (second-most recently used) Command Post window is set to.
  715.  
  716. If there is no other Command Post window (or if this one was the first), then the disk and directory of the current window will be used.
  717.  
  718. a=OtherDir()
  719. Message("The Other Directory is",a)
  720. ----------------------------------------
  721. ----------------------------------------
  722. OtherUpdate ()
  723. ........................................
  724. Causes the "other" (second-most recently used) Command Post window to update its display.  This command is useful when the current Command Post window may have altered the directory or file structure so that an update is
  725. desirable.
  726. ----------------------------------------
  727. ----------------------------------------
  728. Pause (title, text)
  729. ........................................
  730. Presents the user with a message box, using the "title" and "text" supplied.
  731. The box has two buttons - OK and CANCEL. 
  732. If OK is selected, processing continues. 
  733. If CANCEL is selected, processing terminates.
  734.  
  735. Pause("Hey You","Insert Floppy in A:")
  736. FileCopy("C:\DOC\*.DOC","A:")
  737. ----------------------------------------
  738. ----------------------------------------
  739. Random (max)
  740. ........................................
  741. Returns a psuedo-random integer between 0 and "max".
  742.  
  743. A=Random(10)    ; between 0 and 10
  744. B=Random(20)    ; between 0 and 20
  745. c=Random(10)+10 ; between 10 and 20
  746. ----------------------------------------
  747. ----------------------------------------
  748. Run     (program, parameters)
  749. ........................................
  750. Runs a "program" with the specified "parameters".
  751.  
  752. The program's window is passed a request to show itself as a default window size & position.
  753.  
  754. Run("notepad.exe","win.ini")
  755. run("Clock.exe","") ; note empty parms
  756.  
  757. ----------------------------------------
  758. ----------------------------------------
  759. RunHide (program, parameters)
  760. ........................................
  761. Runs a "program" with the specified "parameters".
  762.  
  763. The program's window is passed a request to hide itself.
  764.  
  765.  
  766. RunHide("notepad.exe","win.ini")
  767. runHide("Clock.exe","") ; no parms
  768.  
  769. ----------------------------------------
  770. ----------------------------------------
  771. RunIcon (program, parameters)
  772. ........................................
  773. Runs a "program" with the specified "parameters".
  774.  
  775. The program's window is passed a request to show itself as an icon ('minimized' window).
  776.  
  777.  
  778. RunIcon("notepad.exe","win.ini")
  779. runIcon("Clock.exe","") ; no parms
  780.  
  781. ----------------------------------------
  782. ----------------------------------------
  783. RunZoom (program, parameters)
  784. ........................................
  785. Runs a "program" with the specified "parameters".
  786.  
  787. The program's window is passed a request to show itself as a full-screen ('maximized') window.
  788.  
  789.  
  790. RunZoom("notepad.exe","win.ini")
  791. runZoom("sol.exe","") ; no parms
  792.  
  793. ----------------------------------------
  794. ----------------------------------------
  795. SetDisplay (detail, sort, masks)
  796. ........................................
  797. Configures the Command Post window.
  798. detail -  "SHORT" or "LONG"
  799. sort-      "NAME",KIND","DATE","SIZE",
  800.                or "UNSORTED"
  801. masks-  which files to show
  802. If all parms = "", the current Command Post directory will be refreshed and displayed.
  803. SetDisplay("SHORT","NAME","*.*"); defalt
  804. SetDisplay("","","") ; update currdir
  805. SetDisplay("","","*.EXE *.COM *.BAT")
  806. ----------------------------------------
  807. ----------------------------------------
  808. StrCat (string [,string]...)
  809. ........................................
  810. Concatenates any number of strings together and returns the concatenated string.
  811.  
  812. crlf=strcat(num2char(13),num2char(10))
  813. a=strcat("line1",crlf,"line2")
  814. ;a="line1
  815. line2"
  816. ----------------------------------------
  817. ----------------------------------------
  818. StrCmp (string1, string2)
  819. ........................................
  820. Compares two strings and return one of three possible values:
  821.  
  822. if "string1" is before "string2"  -1
  823. if "string1" equals    "string2"   0
  824. if "string1" is after  "string2"   1
  825.  
  826.  
  827. ----------------------------------------
  828. ----------------------------------------
  829. StrFill (source, length)
  830. ........................................
  831. Creates a string by concatenating multiple copies of the "source" string to itself until the string length equals "length".
  832.  
  833.  
  834. aa=Strfill("*",20)
  835. message("20 Stars",aa)
  836. ----------------------------------------
  837. ----------------------------------------
  838. StrFix (base, pad, length)
  839. ........................................
  840. If the "base" string is longer than "length" it will be truncated, else if it's shorter than "length" it will be padded with the "pad" string until it is "length" in size.
  841. ----------------------------------------
  842. ----------------------------------------
  843. StrICmp (string1, string2)
  844. ........................................
  845. Compares two strings and returns one of three possible values, IGNORING CASE:
  846.  
  847. if "string1" is before "string2"  -1
  848. if "string1" equals    "string2"   0
  849. if "string1" is after  "string2"   1
  850. ----------------------------------------
  851. ----------------------------------------
  852. StrIndex (string, substring, start, dir)
  853. ........................................
  854. Searches the "string", looking for the first occurrance of the "substring" after the "start" position.  "dir" may be either @FWDSCAN or @BACKSCAN to control the direction of the search.  
  855. example: to parse filename:
  856. a=CurrentFile()
  857. i=strindex(a,".",1,@FWDSCAN)
  858. root=strsub(a,1,i-1)
  859. ext =strsub(a,i+1,strlen(a)-i)
  860. ----------------------------------------
  861. ----------------------------------------
  862. StrLen (string)
  863. ........................................
  864. Returns the length of a "string".
  865.  
  866. a="ABCDE"
  867. Message("Length of ABCDE is",strlen(a))
  868. ----------------------------------------
  869. ----------------------------------------
  870. StrLower (string)
  871. ........................................
  872. Returns the lowercase version of a "string".
  873.  
  874. a=AskLine("Please","Enter Name","")
  875. a=strlower(a)
  876. b=strsub(a,1,1)
  877. b=strupper(b)
  878. c=strsub(a,2,strlen(a)-1)
  879. a=strcat(b,c)
  880. Message("Thanx",a)
  881. ----------------------------------------
  882. ----------------------------------------
  883. StrReplace(string,old,new)
  884. ........................................
  885. StrReplace scans the 'string', searching for occurrances of 'old' and replacing each occurrance with 'new'.
  886. e.g. Copy highlited files to clipboard:
  887.  
  888.   a=FileItemize("")
  889.   crlf=StrCat(Num2Char(13),Num2Char(10))
  890.   StrReplace(a," ",crlf)
  891.   ClipPut(a)
  892. ----------------------------------------
  893. ----------------------------------------
  894. StrScan (main, delims, start, dir)
  895. ........................................
  896. Scans a "string" for the first occurrance of ANY character in the "delims" string.  The scanning starts at "start" position and goes in the "dir" direction, which may be either @FWDSCAN
  897. or @BACKSCAN.
  898. ----------------------------------------
  899. ----------------------------------------
  900. StrSub (string, start, length)
  901. ........................................
  902. Returns the substring of "string" which starts in position "start" and goes for "length" characters.
  903. ----------------------------------------
  904. ----------------------------------------
  905. StrTrim (string)
  906. ........................................
  907. Removes all leading and training spaces, if any, from "string" and returns the trimmed string.
  908. ----------------------------------------
  909. ----------------------------------------
  910. StrUpper (string)
  911. ........................................
  912. Returns the uppercase version of a "string".
  913.  
  914. a=AskLine("Please","Enter Name","")
  915. a=strlower(a)
  916. b=strsub(a,1,1)
  917. b=strupper(b)
  918. c=strsub(a,2,strlen(a)-1)
  919. a=strcat(b,c)
  920. Message("Thanx",a)
  921. ----------------------------------------
  922. ----------------------------------------
  923. Terminate (condition, title, msg)
  924. ........................................
  925. Tests a "condition", and cancels the menu item if it = @TRUE.
  926.  
  927. If "title" or "msg" are not null strings, displays a message box before terminating.
  928.  
  929. a=AskLine("Hi","Enter your age","")
  930. terminate(!IsNumber(a),"","Use numbers")
  931. terminate(a<1 || a>100),"ERR","Ha Ha")
  932. message("Hi","Your age is %a%")
  933. ----------------------------------------
  934. ----------------------------------------
  935. TextBox (title, filename)
  936. ........................................
  937. Displays a file in a listbox with a "title".  It may be used for multiline messages or instructions.
  938.  
  939. If the user highlights a line, it will be returned as a text string, thus TextBox can also be used as a selection box.
  940.  
  941. TextBox("CONFIG.SYS","C:\CONFIG.SYS")
  942. ----------------------------------------
  943. ----------------------------------------
  944. Version ()
  945. ........................................
  946. Returns the version of the current Command Post program.
  947.  
  948.  
  949. a=Version()
  950. Message("Command Post","Version %a%")
  951. ----------------------------------------
  952. ----------------------------------------
  953. WinActivate (partialwindowname)
  954. ........................................
  955. Activates the named window.  Only the first part of the "partialwindowname" is required.
  956.  
  957.  
  958. a=WinItemize()
  959. a=ItemSelect("Choose a Window",a)
  960. WinActivate(a)
  961.  
  962. ----------------------------------------
  963. ----------------------------------------
  964. WinArrange (style)
  965. ........................................
  966. Tiles, stacks, arranges in rows or arranges in columns the various open windows on the screen.
  967.  
  968. "style" may be @ROWS or @COLUMNS
  969.         or @STACK or @ARRANGE
  970.  
  971. WinArrange("Stack")
  972. ----------------------------------------
  973. ----------------------------------------
  974. WinClose (partialwindowname)
  975. ........................................
  976. Closes the first window found in which the first part of the windows name matches "partialwindowname".
  977.  
  978.  
  979. WinClose("Clock")
  980. WinClose("Clo")
  981. ----------------------------------------
  982. ----------------------------------------
  983. WinCloseNot (pwn [,pwn]...)
  984. ........................................
  985. Closes all the windows EXCEPT the ones that match the "partialwindowname"s in the parameter list.
  986.  
  987.  
  988. WinCloseNot("MS-DOS","Clock","PageMa")
  989. ----------------------------------------
  990. ----------------------------------------
  991. WinConfig ()
  992. ........................................
  993. Returns the Windows configuration information as a number.  Bits are defined as follows:
  994.  
  995. 1  Protect Mode  |  64 8086 CPU     
  996. 2  80286 CPU     | 128 80186 CPU 
  997. 4  80386 CPU     | 256 Large PageFrame
  998. 8  80486 CPU     | 512 Small PageFrame
  999. 16 Standard Mode |1024 80x87 Installed
  1000. 32 Enhanced Mode |
  1001. ----------------------------------------
  1002. ----------------------------------------
  1003. WinExist (partialwindowname)
  1004. ........................................
  1005. Returns @TRUE or @FALSE, depending on whether a matching window can be found.
  1006.  
  1007.  
  1008.  
  1009.  
  1010. a=WinExist("Clock")
  1011.  
  1012. ----------------------------------------
  1013. ----------------------------------------
  1014. WinGetActive ()
  1015. ........................................
  1016. Returns the complete title of the currently active window.
  1017.  
  1018. Unless a WinActivate or other command was used, WinGetActive will generally return the current Command Post's window title.
  1019.  
  1020. a=WinGetActive()
  1021. Message("Active window was",a)
  1022. ----------------------------------------
  1023. ----------------------------------------
  1024. WinHide (partialwindowname)
  1025. ........................................
  1026. Hides the first window in which the first part of the window name matches "partialwindowname".  The window still exists, but is not available to the user until a WinShow command is executed.
  1027.  
  1028. run("clock.exe","")
  1029. WinHide("Clock")
  1030. ----------------------------------------
  1031. ----------------------------------------
  1032. WinIconize (partialwindowname)
  1033. ........................................
  1034. Iconizes ('minimizes') the first window in which the first part of the window name matches "partialwindowname". 
  1035.  
  1036. Run("Clock.exe","")
  1037. WinIconize("Clock")
  1038.  
  1039. ;equivalent to
  1040. RunIcon("Clock.exe","")
  1041. ----------------------------------------
  1042. ----------------------------------------
  1043. WinItemize ()
  1044. ........................................
  1045. Returns a list of all the currently- running windows, by window title, separated by tabs within the string.
  1046.  
  1047. ;Closes selected window
  1048. a=WinItemize()
  1049. a=ItemSelect("CLOSE",a)
  1050. WinCLose(a)
  1051. ----------------------------------------
  1052. ----------------------------------------
  1053. WinPlace (x-ul, y-ul, x-br, y-br, pwn)
  1054. ........................................
  1055. Places and sizes a window anywhere on the screen.  Use the WININFO.EXE utility to help write the WinPlace statements.
  1056.  
  1057. x-ul   x co-ordinate upper left
  1058. y-ul   y co-ordinate upper left
  1059. x-br   x co-ordinate bottom right
  1060. y-br   y co-ordinate bottom right
  1061. pwn    partial window name
  1062.  
  1063. WinPlace(10,10,300,300,"Clock")
  1064. ----------------------------------------
  1065. ----------------------------------------
  1066. WinPosition (partialwindowname)
  1067. ........................................
  1068. Returns the current Window position information for the selected Window.  It returns 4 comma separated numbers.
  1069.  
  1070. a=WinPosition("Clock")
  1071.  
  1072. A return value for the above function might be "0,0,100,100".
  1073. ----------------------------------------
  1074. ----------------------------------------
  1075. WinShow (partialwindowname)
  1076. ........................................
  1077. Shows the first window in which the first part of the window name matches "partialwindowname".  
  1078.  
  1079. runhide("clock.exe","")
  1080. WinShow("Clock")
  1081. ----------------------------------------
  1082. ----------------------------------------
  1083. WinTitle (pwn, new-name)
  1084. ........................................
  1085. Changes the title of the first window in which the first part of the window name matches "pwn".  That window will be named "new-name".
  1086. A pwn of "" is the current Command Post Window.
  1087. Note:  Some applications do not take kindly to having their window's title changed.
  1088.  
  1089. WinTitle( "", "My Menu")
  1090. ----------------------------------------
  1091. ----------------------------------------
  1092. WinVersion (@MAJOR | @MINOR)
  1093. ........................................
  1094. Returns the version numbers of the current version of Windows.
  1095. "level" = @MAJOR returns the integer part and @MINOR returns the decimal part (to the right of the decimal).
  1096.  
  1097. r=WinVersion(@MAJOR)
  1098. v=WinVersion(@MINOR)
  1099. Message("Windows Version","%r%.%v%")
  1100. ----------------------------------------
  1101. ----------------------------------------
  1102. WinWaitClose (partialwindowname)
  1103. ........................................
  1104. Suspends menu execution until there are no windows in which the first part of the window title matches "partialwindowname".
  1105.  
  1106. run("notepad.exe","special.txt")
  1107. Message("Edit file","Close when done")
  1108. WinWaitClose("Notepad")
  1109. Message("Edit file","You may continue")
  1110. ----------------------------------------
  1111. ----------------------------------------
  1112. WinZoom (partialwindowname)
  1113. ........................................
  1114. Zooms ('maximizes') the first window in which the first part of the window name matches "partialwindowname".  
  1115.  
  1116.  
  1117. Run("clock.exe","")
  1118. WinZoom("Clock")
  1119.  
  1120. ;equivalent to
  1121. RunZoom("clock.exe","")
  1122. ----------------------------------------
  1123. ----------------------------------------
  1124. Yield
  1125. ........................................
  1126. Suspends menu execution for enough time for other windows to process a few messages.
  1127.  
  1128. run("this.exe","")
  1129. run("that.exe","")
  1130. run("andthe.exe","")
  1131. run("other.exe","")
  1132. Yield
  1133. Message("All Done","Now what?")
  1134. ----------------------------------------
  1135.